﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using T.FAS.Runtime.Base.Entity;
using T.FAS.Runtime.Base.Service;
using T.FAS.Runtime.Base.SGSPI;

namespace T.FAS.Runtime.Base.SGPlugin
{
    public class BranchManageInfoSGService: IBranchManageInfoSGService
    {
        readonly BranchManageInfoService manageInfoService = new BranchManageInfoService();
        /// <summary>
        /// 根据产品ID获取产品版本列表
        /// </summary>
        public List<CommonEntity> GetProductVersions(string productID)
        {
            if (string.IsNullOrEmpty(productID))
                throw new FasException(BaseExceptionCode.ParamIsNullError, "BranchManageInfoSGService.GetProductVersions.productID");
            return manageInfoService.GetProductVersions(productID);
        }
        /// <summary>
        /// 根据产品版本、子系统和模块获取新的版本下的信息
        /// </summary>
        public Dictionary<string, object> GetBranchManageInfo(string productVersionID, string subSystemCode, string moduleCode)
        {
            if (string.IsNullOrEmpty(productVersionID))
                throw new FasException(BaseExceptionCode.ParamIsNullError, "BranchManageInfoSGService.GetBranchManageInfo.productVersionID");
            if (string.IsNullOrEmpty(subSystemCode))
                throw new FasException(BaseExceptionCode.ParamIsNullError, "BranchManageInfoSGService.GetBranchManageInfo.subSystemCode");
            if (string.IsNullOrEmpty(moduleCode))
                throw new FasException(BaseExceptionCode.ParamIsNullError, "BranchManageInfoSGService.GetBranchManageInfo.moduleCode");
            return manageInfoService.GetBranchManageInfo(productVersionID, subSystemCode, moduleCode);
        }
    }
}
